const express = require('express');
const router = express.Router();
const {
    getItems,
    getItemById,
    addItem,
    searchItems,
    deleteItem,
    upload
} = require('../controllers/itemController');

// 公开路由
router.get('/', getItems);
router.get('/search', searchItems);
router.get('/:id', getItemById);

// 需要认证的路由
router.post('/',upload.array('images', 5), addItem);
router.delete('/:id', deleteItem);

module.exports = router; 